
// use "C:\Users\User\Downloads\ZA5160_v4-0-0.dta", clear

use "C:\Users\User\Downloads\ZA5160_v4-0-0.dta", clear

 // Upload Europen Election Studies 2014: Voter Study 2014 
// Schmitt, Hermann; Hobolt, Sara B.; Popa, Sebastian A.; Teperoglou, Eftichia; European Parliament, Directorate-General for Communication, Public Monitoring Unit (2016): European Parliament Election Study 2014, Voter Study, First Post-Election Survey. GESIS Data Archive, Cologne. ZA5160 Data file Version 4.0.0, doi:10.4232/1.12628 

//Keep if country == Italy
keep if country == 1380

// CONTROL VARIABLES
// Woman
gen woman = d10 - 1 
// age
clonevar age = d11r1
// education
clonevar education = d8
replace education = . if education < 0 
recode education (4 = .) (5 = .)
// unemployment 
recode c14 (6 = 1) (1 = 0) (2 = 0) (3 = 0) (4 = 0) (5 = 0) (7 = 0) (8 = 0)
clonevar unemployment = c14
//Tradeunion Membership
recode d76 (4 = 0) (1 = 1) (2 = 1) (3 = 1) (-9 = .)
clonevar tradeunion = d76
// religiosity
gen rel = d75 if d75 > 0
gen rel01 = (rel - 1) / 7
// Party closeness
gen close_pd = (qpp21==4)
gen close_ln = (qpp21==3)
gen close_fi = (qpp21==5 )
gen close_m5s = (qpp21== 12)
gen close_fdi = (qpp21== 9)
gen close_lt = (qpp21== 14)
gen close_ncd = (qpp21== 6)
gen close_udc = (qpp21== 7)

//Independent Variables	
// left-right proximity
recode qpp13 (-9 -8 = .), generate(lr01)
replace lr01 = (lr01 - 1) / 10
rename lr01 lr01_self
// Pro-/-Anti-European Proximity 
recode qpp18 (-999/0 = .), generate(eu01_self)
replace eu01_self = (eu01_self - 1) / 10

//ssc install estout
ssc install estout


//M5S 
//M5S Left-Right Proximity
gen lr01_m5s = 4.7 / 10
gen lrdist01_m5s = abs(lr01_self - lr01_m5s)
//M5S Pro-/-Anti-European Proximity
gen eu01_m5s = (1.4 - 1) / 6
gen eudist01_m5s = abs(eu01_self - eu01_m5s)
//M5S Propensity to Vote (ptv)
gen ptv_m5s = qpp8_4
replace ptv_m5s = . if ptv_m5s < 0
replace ptv_m5s = ptv_m5s -1
//Regression M5S
eststo clear		
eststo: regress ptv_m5s woman age edu rel tradeunion unemployment close_m5s lrdist01_m5s eudist01_m5s
esttab, wide r2 se mtitle

//LN
//LN Left-Right Proximity
gen lr01_ln = 8.9 / 10
gen lrdist01_ln = abs(lr01_self - lr01_ln)
//LN Pro-/-Anti-European Proximity
gen eu01_ln = (1.1 - 1) / 6
gen eudist01_ln = abs(eu01_self - eu01_ln)
//LN Propensity to Vote (ptv)
gen ptv_ln = qpp8_3
replace ptv_ln = . if ptv_ln < 0
replace ptv_ln = ptv_ln -1
//Regression LN
eststo clear		
eststo: regress ptv_ln woman age edu rel tradeunion unemployment close_ln lrdist01_ln eudist01_ln
esttab, wide r2 se mtitle

// FDI
//FDI Left-Right Proximity
gen lr01_fdi = 7.9/ 10
gen lrdist01_fdi = abs(lr01_self - lr01_fdi)
// FDI Pro-/-Anti-European Proximity
gen eu01_fdi = (2.2 - 1) / 6
gen eudist01_fdi = abs(eu01_self - eu01_fdi)
//FDI Propensity to Vote (ptv) 
gen ptv_fdi = qpp8_8
replace ptv_fdi = . if ptv_fdi < 0
replace ptv_fdi = ptv_fdi -1
//Regress FDI
eststo clear		
eststo: regress ptv_fdi woman age edu rel tradeunion unemployment close_fdi lrdist01_fdi eudist01_fdi
esttab, wide r2 se mtitle

// Tsipras List (LT)
//LT Left-Right Proximity
gen lr01_lt = 0.8/ 10 
gen lrdist01_lt = abs(lr01_self - lr01_lt)
// LT Pro-/-Anti-European Proximity
gen eu01_lt = (2.6 - 1) / 6
gen eudist01_lt = abs(eu01_self - eu01_lt)
//LT Propensity to Vote (ptv) 
gen ptv_lt = qpp8_6
replace ptv_lt = . if ptv_lt < 0
replace ptv_lt = ptv_lt -1
//Regress LT
eststo clear		
eststo: regress ptv_lt woman age edu rel tradeunion unemployment close_lt lrdist01_lt eudist01_lt
esttab, wide r2 se mtitle

//PD
//PD Left-Right Proximity
gen lr01_pd = 3.6 / 10
gen lrdist01_pd = abs(lr01_self - lr01_pd)
//PD Pro-/-Anti-European Proximity
gen eu01_pd = (6.6 - 1) / 6
gen eudist01_pd = abs(eu01_self - eu01_pd)
// PD Propensity to Vote (ptv)
gen ptv_pd = qpp8_1
replace ptv_pd = . if ptv_pd < 0
replace ptv_pd = ptv_pd -1
//Regression PD
eststo clear		
eststo: regress ptv_pd woman age edu rel tradeunion unemployment close_pd lrdist01_pd eudist01_pd
esttab, wide r2 se mtitle

//FI
// FI Left-Right Proximity
gen lr01_fi = 6.7 / 10
gen lrdist01_fi = abs(lr01_self - lr01_fi)
//FI Pro-/-Anti-European Proximity
gen eu01_fi = (3.4 - 1) / 6
gen eudist01_fi = abs(eu01_self - eu01_fi)
//FI Propensity to Vote (ptv)
gen ptv_fi = qpp8_2
replace ptv_fi = . if ptv_fi < 0
replace ptv_fi = ptv_fi -1
//Regression FI
eststo clear		
eststo: regress ptv_fi woman age edu rel tradeunion unemployment close_fi lrdist01_fi eudist01_fi
esttab, wide r2 se mtitle

//UDC
//UDC Left-Right Proximity
gen lr01_udc = 5.3 / 10
gen lrdist01_udc = abs(lr01_self - lr01_udc)
//UDC Pro-/-Anti-European Proximity
gen eu01_udc = (6.1 - 1) / 6
gen eudist01_udc = abs(eu01_self - eu01_udc)
//UDC Propensity to Vote (ptv)  
gen ptv_udc = qpp8_5
replace ptv_udc = . if ptv_udc < 0
replace ptv_udc = ptv_udc -1
// Regress UDC 
eststo clear		
eststo: regress ptv_udc woman age edu rel tradeunion unemployment close_udc lrdist01_udc eudist01_udc
esttab, wide r2 se mtitle

//NCD
//NCD Left-Right Proximity
gen lr01_ncd = 6.1 / 10
gen lrdist01_ncd = abs(lr01_self - lr01_ncd)
//NCD Pro-/-Anti-European Proximity
gen eu01_ncd = (5.7 - 1) / 6
gen eudist01_ncd = abs(eu01_self - eu01_ncd)
//NCD Propensity to Vote (ptv)  
gen ptv_ncd = qpp8_7
replace ptv_ncd = . if ptv_ncd < 0
replace ptv_ncd = ptv_ncd -1
//Regress NCD 
eststo clear		
eststo: regress ptv_ncd woman age edu rel tradeunion unemployment close_ncd lrdist01_ncd eudist01_ncd
esttab, wide r2 se mtitle

//Table 3 Electoral Preferences in Italy (2014)
eststo clear		
eststo: regress ptv_m5s woman age edu rel tradeunion unemployment close_m5s lrdist01_m5s eudist01_m5s
eststo: regress ptv_ln woman age edu rel tradeunion unemployment close_ln lrdist01_ln eudist01_ln
eststo: regress ptv_fdi woman age edu rel tradeunion unemployment close_fdi lrdist01_fdi eudist01_fdi
eststo: regress ptv_lt woman age edu rel tradeunion unemployment close_lt lrdist01_lt eudist01_lt
eststo: regress ptv_pd woman age edu rel tradeunion unemployment close_pd lrdist01_pd eudist01_pd
eststo: regress ptv_fi woman age edu rel tradeunion unemployment close_fi lrdist01_fi eudist01_fi
eststo: regress ptv_udc woman age edu rel tradeunion unemployment close_udc lrdist01_udc eudist01_udc		
eststo: regress ptv_ncd woman age edu rel tradeunion unemployment close_ncd lrdist01_ncd eudist01_ncd
esttab, wide r2 se mtitle
esttab using "2014-RISP", wide r2 se mtitle replace
